#include "../../NSNetLibSrc/Framework/ServerFramework/ServerProcessMain.h"
#include "../../NSNetLibSrc/Framework/ServerFramework/ServerOneByOneProcJob.h"

#include "../../NSNetLibSrc/include/NetFramework_MsgDef.h"

class CCertificationMainProcess : public CServerProcessMain
{
public:
	BS_DECLARE_DYNCREATE( CCertificationMainProcess);

};

class TiXmlElement;
class CCertificationServer : public CServerApp
{
public:
	CCertificationServer();

protected:
	typedef void (CCertificationServer::*VARIABLE_HANDLER)( TiXmlElement* ); \
	typedef stdext::hash_map<std::string, VARIABLE_HANDLER> MAP_VARIABLE_HANDLER; \

	MAP_VARIABLE_HANDLER	m_mapArchitectureHandlers;

	LIST_Division*		m_pDivisionList;
	LIST_ServerMachine*	m_pServerMachineList;
	LIST_ServerBody*	m_pServerBodyList;
	LIST_ServerCord*	m_pServerCordList;
	LIST_Module*		m_pModuleList;
	LIST_DedicatedGroup* dedicated_groups_;
	LIST_DedicatedIPBound* dedicated_ip_bounds_;

	CRC32				m_CRC;

public:
	bool RequestCertification()
	{
		InitializeLocalData();

		SetExecutionStep( eSES_Operating);

		return StartupServerNet();
	};

	bool InitializeServerTask_Main();
	
	bool InitializeLocalData();
	bool UninitializeLocalData();

protected:
	void	Certification_Module( TiXmlElement* pElement );
	void	Certification_ServerMachine( TiXmlElement* pElement );
	void	Certification_Division( TiXmlElement* pElement );
	void	Certification_ServerBody( TiXmlElement* pElement );
	void	Certification_ServerCord( TiXmlElement* pElement );
	void	Certification_DedicatedCoordinate(TiXmlElement* element);

protected:
	
	bool RetrieveArchitectureDataFromXML();	
};

CCertificationServer g_CertificationServer;
